package org.atlantis.mina.demo1;

import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IoSession;

/**
 * 负责处理服务器端回执的消息。
 * 
 * @author <a href="mailto:seenoevil.cn@gmail.com">李曦</a>
 * 
 */
public class SimpleMinaClientHandler extends IoHandlerAdapter {

	@Override
	public void messageReceived(IoSession session, Object message)
			throws Exception {
		String str = (String) message;
		System.out.println("服务器端回执的消息：" + str);
		session.write(str);
	}

	@Override
	public void sessionClosed(IoSession session) throws Exception {
		System.out.println("我断开了链接！");
	}

	@Override
	public void sessionOpened(IoSession session) throws Exception {
		System.out.println("我<" + session.getRemoteAddress() + ">要连接上了");
	}
}
